import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
// import { getPersonalInfo } from '@/api'
import { routeBaseURL, baseURL, testBaseURL, bugBaseURL, devBaseURL } from '@/config/index'
export const useAccountStore = defineStore('userInfo', () => {
  const token = ref('')
  const httpUrl = ref('')
  const locationUrl = ref(`${routeBaseURL}`)
  const orgType = ref(5)
  // 是否项目部
  const isProject = computed(() => orgType.value === 5)
  // 是否施工单位
  const isConstruction = computed(() => orgType.value === 4)
  // 是否施工集团
  const isConstructionGroup = computed(() => orgType.value === 10)
  // 是否建设子公司
  const isBuild = computed(() => orgType.value === 2)
  // 是否建设集团
  const isBuildGroup = computed(() => orgType.value === 12)

  const setOrgType = (type: number) => {
    orgType.value = type
  }
  const setAccessParam = async (t: string, type: string) => {
    console.log('setAccessParam', t, type)
    token.value = t
  }

  return {
    orgType,
    isProject,
    isConstruction,
    isConstructionGroup,
    isBuild,
    isBuildGroup,
    token,
    httpUrl,
    locationUrl,
    setOrgType,
    setAccessParam
  }
})
